package MLB::Web::Team;

# Copyright 2008 Ted Romer
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License,
# version 2.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

use strict;
use warnings;

use Exporter::Lite;

use base qw(Class::Accessor);

our @EXPORT = qw(team_from_code);

MLB::Web::Team->mk_ro_accessors
    (qw(
        nickname
        ));

my $_team_descriptions = {
    anamlb => ['Angels'],
    arimlb => ['Diamondbacks'],
    atlmlb => ['Braves'],
    balmlb => ['Orioles'],
    bosmlb => ['Red Sox'],
    chamlb => ['White Sox'],
    chnmlb => ['Cubs'],
    cinmlb => ['Reds'],
    clemlb => ['Indians'],
    colmlb => ['Rockies'],
    detmlb => ['Tigers'],
    flomlb => ['Marlins'],
    houmlb => ['Astros'],
    kcamlb => ['Royals'],
    lanmlb => ['Dodgers'],
    milmlb => ['Brewers'],
    minmlb => ['Twins'],
    nyamlb => ['Yankees'],
    nynmlb => ['Mets'],
    oakmlb => ['Athletics'],
    phimlb => ['Phillies'],
    pitmlb => ['Pirates'],
    sdnmlb => ['Padres'],
    seamlb => ['Mariners'],
    sfnmlb => ['Giants'],
    slnmlb => ['Cardinals'],
    tbamlb => ['Devil Rays'],
    texmlb => ['Rangers'],
    tormlb => ['Blue Jays'],
    wasmlb => ['Nationals'],


};

sub team_from_code {
    my $code = shift;
    return MLB::Web::Team->new
        (
         {
             nickname => $_team_descriptions->{$code}->[0],
         }
         );
}



1;

# Local Variables:
# tab-width:4
# indent-tabs-mode:nil
# End:
